﻿
CREATE proc loadmenuparent  
@MaNhom as int,
@menucap as int  
as  
declare @dem as int   
select @dem=COUNT(*) from QuanTri_PhanNhomMenu Where Cap=@menucap-1  and MaNhomMenuND=@MaNhom
if(@dem>0)  
begin  
select a.MenuID,b.TenMenu,b.TenModule,b.TenThuMuc,b.TenForm,N'Menu Cấp '+cast(a.Cap as nvarchar(50))as CapMenu  
from QuanTri_PhanNhomMenu a,DanhMuc_Menu b Where a.MenuID=b.MenuID and a.Cap=@menucap-1 and a.MaNhomMenuND=@MaNhom 
end  
else  
begin  
select 0 as MenuID,N'Menu Root' as TenMenu,'' as  TenModule,'' as TenThuMuc,'' as TenForm,N'Menu Cấp 0'as CapMenu 
-- from Thuan_Menu Where CapMenu=@menucap-1  
end
